package com.levine.base_libs.model;

import com.levine.base_libs.net.RequestId;

import java.util.HashMap;
import java.util.Map;

public abstract class MBaseCallBack {

    private Map<MDataType, Object> arrayMap = new HashMap<>();
    ;

    public abstract void start(RequestType requestType, RequestId requestId);

    public abstract void success(RequestType requestType, RequestId requestId, Map<MDataType, Object> dataMap);//数据的使用需要进行强转，注意强转的类型

    public void success(RequestType requestType, RequestId requestId) {
        success(requestType, requestId, arrayMap);
    }

    public abstract void fail(RequestType requestType, RequestId requestId);

    public abstract void end(RequestType requestType, RequestId requestId);

    /**
     * 添加数据
     *
     * @param mDataType 数据类型
     * @param data      数据
     */
    public void putData(MDataType mDataType, Object data) {
        arrayMap.put(mDataType, data);
    }

    public Map<MDataType, Object> getDataMap() {
        return arrayMap;
    }

    private class RequestType {
    }
}
